package tt.com.business.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import tt.com.business.mapper.DeadProjectMapper;
import tt.com.business.service.ColdRoomService;
import tt.com.business.service.DeadCosmeticService;
import tt.com.business.service.DeadProjectService;
import tt.com.common.model.Dead;
import tt.com.common.model.DeadCosmetic;
import tt.com.common.model.DeadProject;
import tt.com.common.util.PageUtil;

import java.util.List;

@Service
public class DeadProjectServicelmpl extends ServiceImpl<DeadProjectMapper, DeadProject> implements DeadProjectService {


    @Override
    public ResponseEntity selectPayment() {
        PageUtil pageUtil=new PageUtil();
        IPage<DeadProject> page = new Page<>(pageUtil.getPageIndex(), pageUtil.getPageSize());
        QueryWrapper<DeadProject> qw=new QueryWrapper<>();
        qw.eq("data_status",1);
        qw.eq("chargeable_status",3);
        IPage<DeadProject> page1 = baseMapper.selectPage(page, qw);
        pageUtil.setData(page1);
        //设计总数
        QueryWrapper<DeadProject> qwe=new QueryWrapper<>();
        qwe.eq("data_status",1);
        qwe.eq("chargeable_status",3);
        pageUtil.setTotalSize(baseMapper.selectCount(qwe));
        //设置总页数
        pageUtil.setTotalPage(pageUtil.getPageSize()/pageUtil.getPageSize());

        return new ResponseEntity(pageUtil,HttpStatus.OK);
    }
}

